﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Behavioral.MSTest
{
    //[TestClass]
    //public abstract class UnitTest<TTarget> : UnitTestBase<TTarget>
    //{
    //    [TestCleanup]
    //    public override void TearDown()
    //    {
    //        base.TearDown();
    //    }

    //    protected override void RunAction(TTarget target, Type expectedException)
    //    {
    //        try
    //        {
    //            base.RunAction(target);
    //            throw new AssertFailedException(string.Format("Expected exception ({0}) not thrown.", expectedException.Name));
    //        }
    //        catch(Exception exception)
    //        {
    //            Type exceptionType = exception.GetType();
    //            if (exceptionType != expectedException && !exceptionType.IsSubclassOf(expectedException))
    //            {
    //                throw new AssertFailedException(string.Format("Expected exception '{0}' but '{1}' was thrown", 
    //                    expectedException.Name, exceptionType.Name), exception);
    //            }
    //        }
    //    }
    //}

    //[TestClass]
    //public abstract class UnitTest<TTarget, TReturnType> : UnitTestBase<TTarget, TReturnType>
    //{
    //    [TestCleanup]
    //    public override void TearDown()
    //    {
    //        base.TearDown();
    //    }

    //    protected override void RunAction(TTarget target, Type expectedException)
    //    {
    //        try
    //        {
    //            base.RunAction(target);
    //            throw new AssertFailedException(string.Format("Expected exception ({0}) not thrown.", expectedException.Name));
    //        }
    //        catch (Exception exception)
    //        {
    //            Type exceptionType = exception.GetType();
    //            if (exceptionType != expectedException && !exceptionType.IsSubclassOf(expectedException))
    //            {
    //                throw new AssertFailedException(string.Format("Expected exception '{0}' but '{1}' was thrown",
    //                    expectedException.Name, exceptionType.Name), exception);
    //            }
    //        }
    //    }
    //}
}
